package com.chinadci.smartcommunitysystembackstage.mapper;

import com.chinadci.smartcommunitysystembackstage.entity.ScsOwner;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.mapping.StatementType;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Code Duck
 * @since 2021-04-13
 */
public interface ScsOwnerMapper extends BaseMapper<ScsOwner> {
    //查询所有用户信息
    @Select({"${sql}"})
    List<Map<String,Object>> Selects(String sql);

    //新增用户
    @Select({ "call proc_test(#{oname,mode=IN,jdbcType=VARCHAR},"
            + "#{osex,mode=IN,jdbcType=VARCHAR},"
            + "#{oage,mode=IN,jdbcType=INTEGER},"
            + "#{oparent,mode=IN,jdbcType=INTEGER},"
            + "#{onumber,mode=IN,jdbcType=VARCHAR},"
            + "#{ophone,mode=IN,jdbcType=VARCHAR},"
            + "#{ocompany,mode=IN,jdbcType=VARCHAR},"
            + "#{nid,mode=IN,jdbcType=INTEGER},"
            + "#{uid,mode=IN,jdbcType=INTEGER},"
            + "#{hno,mode=IN,jdbcType=INTEGER},"
            + "#{hsize,mode=IN,jdbcType=INTEGER},"
            + "#{hfloor,mode=IN,jdbcType=VARCHAR},"
            + "#{tid,mode=IN,jdbcType=INTEGER},"
            + "#{result,mode=OUT,jdbcType=INTEGER})" })
    @Options(statementType= StatementType.CALLABLE)
    void Insert(Map<String,Object> params);

    //删除用户
    @Select({ "call proc_del(#{tid,mode=IN,jdbcType=INTEGER},"
            + "#{result,mode=OUT,jdbcType=INTEGER})" })
    @Options(statementType= StatementType.CALLABLE)
    void Del(Map<String,Object> params);
}